package com.installtime.demo.constant;

/**
 * @Classname ResultCodeEnums
 * @Description 返回Result的枚举
 * @Date 2020/7/1 13:52
 * @Created by W.Z
 */
public enum ResultCodeEnums {

    /**
     * 正常返回
     */
    QUERY_OK(200,"查询成功"),
    ADD_SUCCESS(200,"添加成功"),
    UPDATE_SUCCESS(200,"修改成功"),
    DEL_SUCCESS(200,"删除成功"),
    OPERATION_OK(200,"操作成功"),
    /**
     * 错误情况
     */
    OPERATION_FAIL(601001,"操作失败"),
    NOT_FOUND(404101,"未找到"),
    BAD_REQUEST(400001,"错误的请求"),
    ACCOUNT_NOT_FOUND(404102,"用户不存在"),
    WRONG_PASSWORD(400002,"密码错误"),
    PARAM_ERROR(400101,"参数错误"),
    INSERT_ERROR(601101,"添加失败"),
    UPDATE_ERROR(601102,"修改失败"),
    DELETE_ERROR(601103,"删除失败"),
    REQUEST_LIMIT_ERROR(400006,"请求频繁,请稍后重试"),
    TOKEN_INVALID(401001,"token无效或已过期"),
    ILLEGAL_STATE_ERROR(400102,"非法状态"),
    ILLEGAL_PARAM_ERROR(415001,"非法参数{}"),
    ;
    private int code;

    private String message;

    ResultCodeEnums(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
